package com.zh.elec.web.actions;

import java.util.List;

import com.zh.elec.model.ProductBatch;
import com.zh.elec.service.ProductBatchService;
import com.zh.elec.web.actions.base.AbstractAction;

/**
 * 商品批次表
 * @author scy
 *
 */
public class ProductBatchAction extends AbstractAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1400461861440527540L;
	private ProductBatchService productBatchService;
	private ProductBatch productBatch;
	private List<ProductBatch> list;
	/**
	 * 添加
	 * @return
	 */
	public String save(){
		if(productBatch != null){
			productBatch = (ProductBatch)productBatchService.save(productBatch);
			return "success";
		}
		return "add";		
	}
	/**
	 * 修改
	 * @return
	 */
	public String update(){
		productBatch = (ProductBatch)productBatchService.update(productBatch);
		return "success";
	}
	/**
	 * 删除
	 * @return
	 */
	public String del(){
		productBatch = (ProductBatch)productBatchService.del(productBatch);
		return "success";
	}
	/**
	 * 查询
	 * @return
	 */
	public String find(){
		list = productBatchService.findAll();
		return "success";
	}
	/**
	 * 根据name查询
	 * @return
	 */
	public String findByName(){
		String name = "";
		String value= "";
		List<ProductBatch> list = productBatchService.findByName(name, value);
		System.out.println(list.size());
		return "success";
	}
	
	public ProductBatch getProductBatch() {
		return productBatch;
	}
	public void setProductBatch(ProductBatch productBatch) {
		this.productBatch = productBatch;
	}
	public void setProductBatchService(ProductBatchService productBatchService) {
		this.productBatchService = productBatchService;
	}
	public List<ProductBatch> getList() {
		return list;
	}
	public void setList(List<ProductBatch> list) {
		this.list = list;
	}
}
